import java.util.Arrays;

/**
 * Created with Intellij IDEA.
 * Description;
 * User:墨琦
 * Data:2023-09-12
 * Time:13:55
 */
public class Java_1 {

    public static int[] twoSum(int[] nums, int target) {
        int k=nums.length-1;
        int t=0;
        int[] array=new int[2];
        for(int i=0;i<k;i++)
        {
            if(nums[i]>target)
                continue;
            int num=nums[i];
            for(int c=i+1;c<=k;c++)
            {
                if((num+nums[c])==target)
                {
                    array[0]=i;
                    array[1]=c;
                    t=1;
                    break;
                }
            }
            if(t==1)
            {
                break;
            }
        }
        return array;
    }

    public static void main(String[] args) {
        int[] array={-1,-2,-3,-4,-5};
        int[] array2=twoSum(array,-8);
    }
}
